<template>
  <div class="app-container">
    <tabs :tabs="tabs" :isShowNum="false" :currentKey="currentKey" @tab-click="tabClick">
      <el-button
        type="primary"
        size="medium"
        v-show="currentKey === 'Integral'"
        @click="toAddOption"
        >新增</el-button
      >
    </tabs>

    <!-- 动态组件显示 -->
    <component :is="'CompanySetting' + currentKey"></component>
  </div>
</template>

<script>
import CompanySettingIntegral from './components/CompanySettingIntegral.vue'
import CompanySettingParams from './components/CompanySettingParams.vue'
export default {
  name: 'companySetting',
  components: {
    // 积分套餐子组件
    CompanySettingIntegral,
    // 参数设置
    CompanySettingParams
  },
  props: {},
  data() {
    return {
      // 当前激活tab
      currentKey: 'Integral',
      tabs: [
        {
          key: 'Integral',
          label: '积分套餐'
        },
        {
          key: 'Params',
          label: '参数设置'
        }
      ]
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    // tab切换
    tabClick({ key }) {
      this.currentKey = key
    },

    // 新增积分选项
    toAddOption() {
      this.$router.push({ name: 'AddIntegralOption' })
    }
  }
}
</script>

<style lang="scss" scoped></style>
